package com.child.controller;

import com.child.entity.MyUser;
import com.child.service.MyUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * com.child.controller.ChildController
 *
 * @author: wanglei62
 * @DATE: 2022/10/17 14:49
 **/
@Controller
@RequestMapping("/child")
public class ChildController {
    @Autowired
    private MyUserService myUserService;
    @RequestMapping("/test")
    public ResponseEntity<String> test(){
        System.out.println("child test");
        return ResponseEntity.ok("child success");
    }

    @ResponseBody
    @RequestMapping(value="/queryById/{id}")
    //http://127.0.0.1:8899/thd/child/queryById/1
    public ResponseEntity queryMyUserById(@PathVariable String id){
        MyUser mu = myUserService.queryById(id);
        return ResponseEntity.ok(mu);
    }
}
